Use checkout_release_branch from a8c-ci-toolkit - #4472
Conversation
| @@ -127,10 +131,16 @@ steps: | |||
| # Same Docker-on-default-queue pattern as the dev Linux build group | |||
| # (see .buildkite/pipeline.yml): Amazon Linux on `default` lacks | |||
| # `dpkg`/`fakeroot`, so we build inside the Debian Node image. | |||
| # The toolkit is listed so its `environment` hook sets $A8C_CI_TOOLKIT_PLUGIN_DIR | |||
| # before the `docker` plugin resolves the volume below. | |||
| - $CI_TOOLKIT_PLUGIN | |||
| - $DOCKER_PLUGIN: | |||
| image: "$NODE_DOCKER_IMAGE" | |||
| propagate-environment: true | |||
| mount-buildkite-agent: true | |||
| expand-volume-vars: true | |||
| volumes: | |||
| - "$$A8C_CI_TOOLKIT_PLUGIN_DIR:/a8c-ci-toolkit:ro" | |||
There was a problem hiding this comment.
a8c-ci-toolkit plugin from there.
I think that should work in theory, but it might be worth double-checking with some dummy test once a8c-ci-toolkit version 6.3.0 ships. For example, by creating a temporary commit that would use this trick on a dummy step that would use the docker plugin + calls a benign command provided by a8c-ci-toolkit (like hash_file) from within its container.
There was a problem hiding this comment.
Validated via 977fd2b — see #4472 (comment)
Docker mount trick validated on CI ✅The one part of this PR that CI can't exercise on its own is the Linux release build, since the release pipeline only runs at code freeze. So I validated the mechanism directly instead. Temporary commit 977fd2b (reverted in the commit right after) pointed The job passed on the And the The branch is back to normal — the pin reads |
This reverts commit 977fd2b.
mokagio
left a comment
There was a problem hiding this comment.
Re-run CI after releasing CI toolkit 6.3.0. All green, however... we are lacking two required steps that don't seem to have been resolved during the pipeline upload
| set -eu | ||
|
|
||
| # The toolkit's commands are on the host's PATH, not the container's; the plugin | ||
| # directory is bind-mounted at /a8c-ci-toolkit by the `volumes` entry below. | ||
| export PATH="$$PATH:/a8c-ci-toolkit/bin" | ||
|
|
||
| # The container has no SSH keys / known_hosts, use anonymous HTTPS | ||
| git remote set-url origin https://github.com/Automattic/studio.git | ||
|
|
||
| bash .buildkite/commands/checkout-release-branch.sh "${RELEASE_VERSION}" | ||
| checkout_release_branch "${RELEASE_VERSION}" | ||
|
|
||
| apt-get -o Acquire::Retries=3 update | ||
| apt-get install -y --no-install-recommends fakeroot | ||
|
|
||
| # `--maxsockets 1` works around npm/cli#4652 (ECONNRESETs on Linux); | ||
| # see install-node-dependencies.sh for the original rationale. | ||
| npm ci --unsafe-perm --no-audit --no-progress --maxsockets 1 | ||
|
|
||
| echo "--- :node: Building DEB" | ||
| npm run make:linux-{{matrix}} | ||
|
|
||
| echo "--- :package: Building standalone CLI bundle" | ||
| npm run cli:bundle -- linux {{matrix}} |
There was a problem hiding this comment.
Wonder if we could benefit from pushing this into a script that takes ARCHITECTURE x64|arm64 as input (and maybe ${RELEASE_VERSION} too, although that could be resolved from the env internally as others do).
Related issues
How AI was used in this PR
Written with Claude Code, and reviewed by me. The mechanical part — swapping call sites and deleting the script — was scripted and applied identically across the 13 repos that carried this file. The Docker-specific part below was hand-written and is the piece worth a careful look.
Proposed Changes
.buildkite/commands/checkout-release-branch.shexisted as a byte-identical copy in 13 repos, so any fix to it had to be made 13 times. It now lives ina8c-ci-toolkitas thecheckout_release_branchcommand, and this repo calls that instead. No behaviour change: the command is a straight port of the deleted script.Studio needed one thing the other repos didn't. The Linux release build runs inside a container via the
dockerplugin, and toolkit commands reach a job by being added to the host's$PATH— which a container doesn't inherit. That step now also loads the toolkit plugin, which exports$A8C_CI_TOOLKIT_PLUGIN_DIR, bind-mounts that directory into the container read-only, and puts itsbin/on the$PATHinside.expand-volume-varsis what makes thedockerplugin interpolate the variable, and the$$defers it to run time rather than pipeline upload time.The Windows step keeps invoking through
bash, which resolves a slash-less filename against$PATH, so no change was needed there.The toolkit pin moves from
6.1.1to6.3.0. I checked the toolkit'sCHANGELOG.mdfor breaking changes between those versions; none apply here.Testing Instructions
Not exercisable before the toolkit release. Once
6.3.0is out, the release pipeline covers all three shapes: the Mac steps (plain host$PATH), the Windows step (bash checkout_release_branch), and the Linux step (mounted into the container) should each check out the release branch as before.Pre-merge Checklist
Merge only after toolkit release
Important
Do not merge until
a8c-ci-toolkit6.3.0is released — the pin doesn't resolve before then, so CI will keep failing until it is.